﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SistemaAcademicoBO.Entities;
using SistemaAcademicoBO;
using SistemaAcademicoDAL;

namespace SistemaAcademicoBLL.Managers
{
    class UserManager
    {
         private UserDAO userDAO;

        public UserManager()
        {
            userDAO = new UserDAO();
        }

        public User GetUser(int id)
        {
            return (User)userDAO.GetRecord(id);
        }

        public List<User> GetAllUsers()
        {
            List<IEntity> entityList = userDAO.GetAllRecords();
            List<User> userList = new List<User>();
            foreach (IEntity entity in entityList)
            {
                userList.Add((User)entity);
            }

            return userList;
        }

        public void SetUser(User user)
        {
            userDAO.SetRecord(user);
        }

        public void RemoveUser(int id)
        {
            userDAO.RemoveRecord(id);
        }

        public User GetUserByUserLogin(string userLogin)
        {
            return (User)userDAO.GetRecordByUserLogin(userLogin);
        }
    }
}
